
<?php

if($_SERVER['HTTP_X_REQUESTED_WITH'])
{
	$str = '';
	$page = empty($_GET['page'])?1:$_GET['page'];
	$len=5;
	$news = partion($page,'news',$len);
	$count = selectOne('news','1','count(*) as count')['count'];
	$str = partienRender($count,$len,$page);
	//处理时间戳
	foreach($news as $k=>$v)
	{
		foreach($v as $key=>$val)
		{
			if($key=='time')
			{
				$news[$k][$key]=date('Y-m-d h:i',$val);
			}
		}
	}
	echo json_encode(array('table'=>$news,'render'=>$str));
	die;
}

$str = '';
$page = empty($_GET['page'])?1:$_GET['page'];
$len=5;
$news = partion($page,'news',$len);
$count = selectOne('news','1','count(*) as count')['count'];
$str = partienRender($count,$len,$page);
$cate = selectAll('newscate');
//print_r($cate);die;


include('app/admin/news/html/index.html');
?>
